// import { userInfoApi, userRoleApi } from '../apis/login'

export default {
  // 开启命名空间
  namespaced: true,
  state: {
    token: '',
    userInfor: {},
    userRole: []
  },
  getters: {
    getToken (state) {
      return state.token
    },
    getUserInfor (state) {
      return state.userInfor
    },
    getUserRolen (state) {
      return state.userRole
    }
  },
  // actions: {
  //     let userInfo = {id: 'admin', name: '超级管理员'}
  //     let userRole = [{id: 'user', role: ['C', 'R']}]
  //     commit('mutationUserInfo', userInfo)
  //     commit('mutationUserRole', userRole)
  //   }
  // },
  mutations: {
    mutationToken (state, token) {
      state.token = token
    },
    mutationUserInfo (state, userInfor) {
      state.userInfor = userInfor
    },
    mutationUserRole (state, userRole) {
      state.userRole = userRole
    }
  }
}
